﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model;

namespace ImportPlcPointPosition.Models {
    [SugarTable("cks_virtual_table")]
    public class CksVirtualTable : BaseEntity {
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        public string TableName { get; set; }

        public int Sequence { get; set; }

        public string LanguageKey { get; set; } = string.Empty;

        public string Notes { get; set; } = string.Empty;

        public DateTime CreatedTime { get; set; } = DateTime.Now;

    }


    [SugarTable("cks_virtual_column")]
    [FreeSql.DataAnnotations.Table(Name = "cks_virtual_column")]
    public class CksVirtualColumn : BaseEntity {
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        public int TableId { get; set; }

        public string ColumnName { get; set; } = string.Empty;

        public string Notes { get; set; } = string.Empty;

        public int Sequence { get; set; } = 99;

        public int DataId { get; set; }

        /// <summary>
        /// 客户端Web是否展示
        /// </summary>
        public bool IsDisplay { get; set; }

        private bool isPrimary;
        public bool IsPrimary {
            get => isPrimary;
            set {
                isPrimary = value;
                OnPropertyChanged("IsPrimary");
            }
        }


        private bool isResult;
        public bool IsResult {
            get => isResult;
            set {
                isResult = value;
                OnPropertyChanged("IsResult");
            }
        }


        private bool isCycleTime;
        public bool IsCycleTime {
            get { return isCycleTime; }
            set {
                isCycleTime = value;
                base.OnPropertyChanged();
            }
        }


        private bool isBatchCode;
        public bool IsBatchCode {
            get { return isBatchCode; }
            set {
                isBatchCode = value;
                base.OnPropertyChanged();
            }
        }

        /// <summary>
        /// 宽度
        /// </summary>
        public int Width { get; set; }

        public string LanguageKey { get; set; } = string.Empty;

        public DateTime CreatedTime { get; set; } = DateTime.Now;

        #region Ignore

        [SugarColumn(IsIgnore = true)]
        public Guid Guid { get; set; } = Guid.NewGuid();

        bool _IsCheck = false;
        /// <summary>
        /// 复选框
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsCheck {
            get => _IsCheck;
            set {
                if (_IsCheck == value) return;
                _IsCheck = value;
                base.OnPropertyChanged();
            }
        }
        #endregion

    }
}
